package flc.ast.adapter;

import androidx.annotation.NonNull;

import com.chad.library.adapter.base.provider.BaseItemProvider;
import com.chad.library.adapter.base.viewholder.BaseViewHolder;

import flc.ast.R;
import flc.ast.bean.MySubsectionBean;
import stark.common.basic.adaptermutil.StkProviderMultiAdapter;
import stark.common.basic.adaptermutil.StkSingleSpanProvider;

public class SubsectionAdapter extends StkProviderMultiAdapter<MySubsectionBean> {

    public SubsectionAdapter() {
        addItemProvider(new StkSingleSpanProvider(30));
        addItemProvider(new SubsectionProvider());
    }

    private class SubsectionProvider extends BaseItemProvider<MySubsectionBean> {
        @Override
        public int getItemViewType() {
            return StkProviderMultiAdapter.TYPE_VIEW;
        }

        @Override
        public int getLayoutId() {
            return R.layout.item_subsection;
        }

        @Override
        public void convert(@NonNull BaseViewHolder baseViewHolder, MySubsectionBean bean) {
            baseViewHolder.setText(R.id.tvSubsectionItemName, bean.getName());
            baseViewHolder.setText(R.id.tvSubsectionItemTime, bean.getTime());
        }
    }
}
